package com.gitee.theskyzero.data.db.jpa;

import com.gitee.theskyzero.data.db.Test;
import com.sun.istack.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

@RestController
@RequestMapping("/data/db/jpa")
public class JpaRestController {

    @Autowired
    TestRepository repository;

    @GetMapping("/{id")
    public Optional<Test> findById(@NotNull @PathVariable Long id) {
        return repository.findById(id);
    }
}
